<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box{
      width: 200px;
      height: 200px;
      background-color: rgb(173, 72, 72);
      margin: 20px auto;
    }
    /* 定义入开始状态 */
    .ani-enter{
      transform: translateX(-500px) scale(0.1) rotate(360deg);
      opacity: 0;
    }
    /* 定义出场最终状态 */
    .ani-leave-to{
      transform: translateY(500px) scale(0.1) rotate(360deg);
      opacity: 0;
    }
    /*定义入场 过渡 使用 transition  */
    .ani-enter-active,.ani-leave-active{
      transition: all 500ms;
    }
  </style>
</head>
<body>
  <div id="app">
    <button @click="isShow = !isShow">{{isShow?'隐藏':'显示'}}</button>
    <transition name="ani">
      <div class="box" v-if="isShow"></div>
    </transition>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data:{
        isShow: true
      }
    })
  </script>
</body>
</html>